//
//  XSJStatus.swift
//  weiBo项目准备
//
//  Created by 鲜世杰 on 16/5/14.
//  Copyright © 2016年 鲜世杰. All rights reserved.
//

import UIKit

class XSJStatus: NSObject {
    var created_at : String?
    var id : Int64 = 0
    var text : String?
    var source : String?
    var user : XSJUser?
    
    var reposts_count: Int = 0
    ///  评论数
    var comments_count: Int = 0
    ///  表态数
    var attitudes_count: Int = 0
    
    var retweeted_status : XSJStatus?
    
    var pic_urls : [XSJStatusPictureInfo]?
    init(dic : [String : AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dic)
    }
    override func setValue(value: AnyObject?, forKey key: String) {
        if key == "user"
        {
        
            guard let dic = value as? [String : AnyObject] else{
            return
            }
            user = XSJUser(dic: dic)
            
         } else if key == "retweeted_status"{
            guard let dic = value as? [String : AnyObject] else{
            
                return
                
            }
            retweeted_status = XSJStatus(dic: dic)
          
        } else if key == "pic_urls"{
            guard let dicArray = value as? [[String : AnyObject]] else {
            return
            }
            var tempArray = [XSJStatusPictureInfo]()
            for dic in dicArray {
            let picInfo = XSJStatusPictureInfo(dic: dic)
                tempArray.append(picInfo)
            }
            pic_urls = tempArray
            
        } else
        {
        super.setValue(value, forKey: key)
            
        }
        
    }
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
}
